String.prototype.stripTags = function() {
	return this.replace(/<\/?[^>]+>/gi, '');
}
String.prototype.toQueryParams = function(separator) {
	var match = this.trim().match(/([^?#]*)(#.*)?$/);
	if (!match) return {};

	var hash = {};
	match[1].split(separator || '&').each(function(pair) {
		if ((pair = pair.split('='))[0]) {
			var name = decodeURIComponent(pair[0]);
			var value = pair[1] ? decodeURIComponent(pair[1]) : undefined;

			if (hash[name] !== undefined) {
				if ($type(hash[name]) != 'array') hash[name] = [hash[name]];
				if (value) hash[name].push(value);
			} else hash[name] = value;
		}
	});
	return hash;
}
String.prototype.contains = function(string, separator) {
	return (separator)
			? (separator + this + separator).indexOf(separator + string + separator) > -1
			: this.indexOf(string) > -1;
}
String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g, '');
}
String.prototype.blank = function() {
	return this.replace(/^\s+|\s+$/g, '').length == 0;
}

function $extend(original, extended) {
	for (var key in (extended || {}))
		original[key] = extended[key];
	return original;
};
Array.prototype.each = function(fn, bind) {
	for (var i = 0, l = this.length;i < l; i++)
		fn.call(bind, this[i], i, this);
}
